local Config = require("Config")
local InnerMemberDefine = require("scene.InnerMemberDefine")
local PfLogic = require("tencentApi.PfLogic")
local lua_mongo = _G.lua_mongo
local statusTimeout = 300

function AuthCheck(account, authkey, timestamp,serverid, fcm,openid,openkey,pf,pfkey, yellowYearVip, yellowVip, yellowVipLv)
	if Config.CHECK_AUTH2 == false then
		return true
	end
	
	--内部用户直接验证通过
	if InnerMemberDefine[openid] then
		return true
	end
	
	-- 时间戳认证
	if false and timestamp ~= 0 then
		local timeNow = os.time()
		if timestamp - timeNow > statusTimeout or timeNow - timestamp > statusTimeout then
			return false
		end
	end	
	local extendsStr = ""
	if PfLogic.isAgentTencent() then
	   extendsStr = extendsStr..openid..openkey..pf..pfkey..yellowVip..yellowVipLv..yellowYearVip
	else
	   extendsStr = account
	end
	local calckey = lua_mongo.md5(extendsStr..timestamp..serverid..Config.AUTH_KEY)	
	if calckey == authkey then
		return true
	else
		return false
	end
end
